package org.gdkm.springbootxiangmushizhan.service.impl;

import org.gdkm.springbootxiangmushizhan.domain.vo.CategoryAdminVO;
import org.gdkm.springbootxiangmushizhan.mapper.CategoryMapper;
import org.gdkm.springbootxiangmushizhan.service.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;

@Service
@Transactional
public class CategoryServiceImpl implements ICategoryService {
    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public List<CategoryAdminVO> selectAllCategories() {
        return categoryMapper.selectAllCategories();
    }

    @Override
    public List<CategoryAdminVO> selectCategoriesByName(String name) {
        return categoryMapper.selectCategoriesByName(name);
    }

    @Override
    public void insertCategory(String name, String description, Date created, Date modified) {
        categoryMapper.insertCategory(name, description, created, modified);
    }

    @Override
    public void updateCategory(Integer id, String name, String description, Date modified) {
        categoryMapper.updateCategory(id, name, description, modified);
    }

    @Override
    public void deleteCategory(Integer id) {
        categoryMapper.deleteCategory(id);
    }

    @Override
    public CategoryAdminVO selectCategoryById(Integer id) {
        return categoryMapper.selectCategoryById(id);
    }
} 